#ifndef ENEMY_CPP
#define ENEMY_CPP
#include "Enemy.h"
#include "Renderer.h"
#include <new>

Enemy::Enemy(int x, int y)
{
	m_objectType = OBJECT_TYPE::ENEMY;
	Position& pos = GetPosition();

	pos.x = x;
	pos.y = y;
	pos.height = 10;
	pos.width = 10;
	m_health = 10;
	m_speed = 1;
}
Enemy::Enemy(long long id, int x, int y)
{
	m_objectType = OBJECT_TYPE::ENEMY;
	m_objectID = id;
	Position& pos = GetPosition();

	pos.x = x;
	pos.y = y;
	pos.height = 10;
	pos.width = 10;
	m_health = 10;
	m_speed = 1;
}
Enemy::~Enemy(void)
{

}
void Enemy::DestroyData(void)
{
	//Renderer::GetInstance().FreeTexture(m_texture);
}
bool Enemy::Hit(int damage)
{
	m_health -= damage;
	if (m_health <= 0)
	{
		return true;
	}
	return false;
}
void Enemy::Copy(void* address)
{
	new (address) Enemy(*this);
}
void Enemy::Update(void)
{
	GetPosition().y += m_speed;;
}
void Enemy::Draw(void)
{
	Renderer::GetInstance().DrawObject(*this);
}
int Enemy::GetObjSize(void)
{
	return sizeof(*this);
}
SDL_Texture* Enemy::GetTexture(void)
{
	static SDL_Texture* texture = 0;
	if (!texture)
	{
		texture = Renderer::GetInstance().LoadTexture("c:/test.bmp");
	}
	return texture;
}
int Enemy::GetHealth(void)
{
	return m_health;
}
#endif